<template>
	<view>
		<view>
			<view class="top-text">提现记录</view>
		</view>
		<u-card v-for="(item,index) in data" :title="title" :sub-title="item.create_time" >
			<view class="" slot="body">
				<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
					<view class="u-body-item-title u-line-2">提现金额：￥{{item.money}}</view>
				</view>
				<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
					<view class="u-body-item-title u-line-2" v-if="item.status == 0">订单状态：待打款</view>
					<view class="u-body-item-title u-line-2" v-else-if="item.status == 1">订单状态：打款成功</view>
					<view class="u-body-item-title u-line-2" v-else>订单状态：拒绝打款</view>
				</view>
				<view class="u-body-item u-flex u-border-bottom u-col-between u-p-t-0">
					<view class="u-body-item-title u-line-2">打款备注：{{item.note}}</view>
				</view>
			</view>
		</u-card>
	</view>
</template>

<script>
export default {
	data() {
		return {
			title: '提现记录',
			subTitle: '2020-05-15',
			offset: 1,
			limit: 10,
			maxOffset: 0,
			data:[],
			userInfo:[],
		
		};
	},
	onLoad() {
		uni.showLoading({
			title: '加载中...'
		});
		 this.userInfo = uni.getStorageSync('userInfo');
		 this.getDrawal(this.userInfo.id);
	},
	onReachBottom() {
			if(this.offset > this.maxOffset){
				uni.showToast({
					title:'到底部了',
					icon:'none'
				})
			}else{
				this.getDrawal(this.userInfo.id)
			}
			
	},
	methods:{
		getDrawal(id){
			let that = this;
			this.$request.httpTokenRequest({
				url:'/admin/agent/getDrawal',
				method:'POST',
				data:{
					agentID:id,
					offset:that.offset,
					limit:that.limit,
				}
			}).then(res => {
				if(res.data.code == 200){
						uni.hideLoading();
						that.data = that.data.concat(res.data.content.data);
						that.maxOffset =  Math.ceil(res.data.content.count/that.limit);
						that.offset += 1;
				}
			}, error => {});
		}
	}
};
</script>

<style scoped lang="scss">
	.u-card-wrap { 
		background-color: $u-bg-color;
		padding: 1px;
	}
	
	.u-body-item {
		font-size: 32rpx;
		color: #333;
		padding: 20rpx 10rpx;
	}
		
	.u-body-item image {
		width: 120rpx;
		flex: 0 0 120rpx;
		height: 120rpx;
		border-radius: 8rpx;
		margin-left: 12rpx;
	}
	.top-text{
		text-align: center;
		line-height: 100rpx;
		font-size: 30rpx;
		font-weight: 600;
	}
</style>